package com.dynamixsoftware.printershare;

import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Picture;
import android.graphics.Rect;
import android.os.Bundle;
import com.dynamixsoftware.printershare.data.Paper;
import java.util.Vector;

public class ActivityPrintWeb
  extends ActivityPrint
{
  Picture pic;
  
  protected void createPages()
  {
    int j;
    int k;
    int m;
    Picture localPicture1;
    int n;
    int i1;
    int i3;
    int i5;
    if (this.margins == 1)
    {
      j = 96 / 4;
      k = 96 * this.paper.width / 254;
      m = 96 * this.paper.height / 254;
      this.pages = new Vector();
      localPicture1 = new Picture();
      if (this.pic == null) {
        return;
      }
      n = this.pic.getWidth();
      i1 = this.pic.getHeight();
      if ((this.orientation == 2) || ((this.orientation == 0) && (n > i1)))
      {
        int i2 = k;
        k = m;
        m = i2;
      }
      i3 = k - j * 2;
      int i4 = m - j * 2;
      if ((n >= i3) || (i1 >= i4)) {
        break label417;
      }
      i3 = n;
      i5 = i1;
    }
    for (;;)
    {
      int i6 = 0;
      int i7 = i5;
      while (i7 > 0)
      {
        if (i6 > 0)
        {
          if (localPicture1 != null)
          {
            localPicture1.endRecording();
            Vector localVector2 = this.pages;
            ActivityPrint.Page localPage2 = new ActivityPrint.Page(localPicture1);
            localVector2.add(localPage2);
          }
          localPicture1 = new Picture();
        }
        Canvas localCanvas = localPicture1.beginRecording(k, m);
        localCanvas.drawColor(-1);
        localCanvas.save();
        localCanvas.translate(0.0F, -i6 * (m - j * 2));
        Picture localPicture2 = this.pic;
        Rect localRect1 = new Rect(j, j, j + i3, j + i5);
        localCanvas.drawPicture(localPicture2, localRect1);
        localCanvas.restore();
        Paint localPaint = App.newPaint();
        localPaint.setColor(-1);
        localPaint.setStyle(Paint.Style.FILL);
        Rect localRect2 = new Rect(0, 0, k, j);
        localCanvas.drawRect(localRect2, localPaint);
        Rect localRect3 = new Rect(0, m - j, k, m);
        localCanvas.drawRect(localRect3, localPaint);
        i7 -= m - j * 2;
        i6++;
      }
      if (this.margins == 2)
      {
        j = 96 / 3;
        break;
      }
      int i = this.margins;
      j = 0;
      if (i != 3) {
        break;
      }
      j = 96 / 2;
      break;
      label417:
      if (n > i1)
      {
        i5 = i1 * i3 / n;
      }
      else if (n < i3)
      {
        i3 = n;
        i5 = i1;
      }
      else
      {
        i5 = i1 * i3 / n;
      }
    }
    if (localPicture1 != null)
    {
      localPicture1.endRecording();
      Vector localVector1 = this.pages;
      ActivityPrint.Page localPage1 = new ActivityPrint.Page(localPicture1);
      localVector1.add(localPage1);
    }
  }
  
  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    if ("web".equals(getIntent().getAction()))
    {
      this.pic = ActivityWeb.pp;
      ActivityWeb.pp = null;
      return;
    }
    this.pic = ActivityGmailConversation.pp;
    ActivityGmailConversation.pp = null;
    this.orientation = 1;
  }
}


/* Location:           C:\Users\Admin\Desktop\Decompiler\JAD\jd-gui-0.3.6.windows\classes_dex2jar.jar
 * Qualified Name:     com.dynamixsoftware.printershare.ActivityPrintWeb
 * JD-Core Version:    0.7.0.1
 */